package exception;

import java.util.Scanner;

public class Exception01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        GirlFriend gf = new GirlFriend();
        while (true) {
            try {
                System.out.println("请输入你女朋友的名字：");
                String name = sc.nextLine();
                gf.setName(name);
                System.out.println("请输入你女朋友的年龄：");
                String age = sc.nextLine();
                gf.setAge(Integer.parseInt(age));
                break;
            } catch (NameFormatterException e) {
                e.printStackTrace();
            } catch (AgeFomatterException a) {
                a.printStackTrace();
            }
        }
        System.out.println(gf);
    }
}
